//
//  DENBaseModel.m
//  Icar
//
//  Created by apple on 15/10/16.
//  Copyright © 2015年 小龙侠. All rights reserved.
//

#import "DENBaseModel.h"

@implementation DENBaseModel

- (instancetype)initWithDictionary:(NSDictionary *)dic{
    
    if (self = [super init]) {
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}

+ (instancetype)modelWithDictionary:(NSDictionary *)dictionary{
    
    return [[self alloc]initWithDictionary:dictionary];
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
    if ([key isEqualToString:@"id"]) {
        
        self.cid = value;
        
    }
    
}
- (void)encodeWithCoder:(NSCoder *)aCoder{
    [aCoder encodeObject:self.cid forKey:@"id"];
}

#pragma mark - 解码读取

- (id)initWithCoder:(NSCoder *)aDecoder{
    self = [super init];
    if (self) {
        self.cid = [aDecoder decodeObjectForKey:@"id"];
        
    }
    return self;
}

@end
